
**************************************************************
** Replication files for Daoust et al. 2021					**
** Published in PLOS Onedate								**
** Date : April 2021										**
**************************************************************

*Load the dataset
use "main_data.dta", clear

**************************************************************
** 						Preparation							**	
**************************************************************

*Country ID variable
gen countryid=country
label define COUNTRY_NAMES 1"Australia" 2"Austria" 3"Brazil" 4"France" 5"Germany" 6"Italy" 7"NZ" 8"Poland" 9"Spain" 10"Sweden" 11"UK" 12"USA"
label value  countryid COUNTRY_NAMES

*Label variables
label variable no_mask "No mask"
label variable greeting "Greeting"
label variable host "Host"
label variable social_distance "No distance"
label variable age "Age"
label variable female "Gender (1=female)"
label variable education "Education"
label variable occasion_mask "Occasionally"
label variable occasion_greeting "Occasionally"
label variable occasion_host "Occasionally"
label variable occasion_distance "Occasionally"
label variable necessary_mask "Only when necessay"
label variable necessary_greeting "Only when necessay"
label variable necessary_host "Only when necessay"
label variable necessary_distance "Only when necessay"

**************************************************************
** 						Main analyses						**	
**************************************************************

*Figure 1
cibar no_mask , over1(treatment) over2(countryid)  level(95) ///
		graphopts( text(.9 27 "ATE = +.09")  xlabel(, valuelabel alternate labsize(vsmall)) ylabel(0(.1)1) legend(pos(6) row(1) order(1 "Control group" 2 "Guilt-free treatment") )  ///
		ytitle("Mean of non-compliance")  title("Panel a:" "Not wearing a face mask", size(small)))
graph save fig1_a.gph, replace	

cibar greeting , over1(treatment) over2(countryid) level(95) ///
		graphopts(text(.9 27 "ATE = +.12")  xlabel(, valuelabel alternate labsize(vsmall)) ylabel(0(.1)1) legend(pos(6) row(1) order(1 "Control group" 2 "Guilt-free"))  ///
		ytitle("")  title("Panel b:" "Greeting", size(small)))
graph save fig1_b.gph, replace	
		
cibar host , over1(treatment) over2(countryid) level(95) ///
		graphopts(text(.9 27 "ATE = +.16")  xlabel(, valuelabel alternate labsize(vsmall))  ylabel(0(.1)1) legend(pos(6) row(1) order(1 "Control group" 2 "Guilt-free"))  ///
		ytitle("Mean of non-compliance")  title("Panel c:" "Host", size(small))) 
graph save fig1_c.gph, replace	
		
cibar social_distance , over1(treatment) over2(countryid) level(95) ///
		graphopts(text(.9 27 "ATE = +.14")  xlabel(, valuelabel alternate labsize(vsmall)) ylabel(0(.1)1) legend(pos(6) row(1) order(1 "Control group" 2 "Guilt-free"))  ///
		ytitle("")  title("Panel d:" "No distance", size(small)))
graph save fig1_d.gph, replace	

grc1leg  fig1_a.gph fig1_b.gph fig1_c.gph fig1_d.gph, legendfrom(fig1_a.gph)  row(2) ysize(18)
	
*Figure 2
*Panel a: gender
logit no_mask i.female##i.treatment
est store Face_Mask
est store m1
logit greeting i.female##i.treatment 
est store Greeting
est store m2
logit host i.female##i.treatment 
est store Host
est store m3
logit social_distance i.female##i.treatment 
est store Distance
est store m4

coefplot Face_Mask Greeting Host Distance, keep(1.female#1.treatment) level(95) vertical yline(0, lcolor(black)) ///
			xtitle("Interaction coefficient") xlabel("") title("Panel a. Gender")  ysize(12) xsize(8) ///
			legend(position(6) row(1))
graph save fig2_gender.gph,  replace

*To get the regression outputs for Table C.1
esttab ///
      m1 m2 m3 m4 ///
       using "tablec1.rtf", ///
	   label mlabels(,titles) nogap compress b(2) se(2) nostar nonumbers   replace
	
*Panel b: age
logit no_mask c.age##i.treatment
est store Face_Mask
est store m5
logit greeting c.age##i.treatment 
est store Greeting
est store m6
logit host c.age##i.treatment 
est store Host
est store m7
logit social_distance c.age##i.treatment 
est store Distance
est store m8

coefplot Face_Mask Greeting Host Distance, keep(1.treatment#c.age) level(95) vertical yline(0, lcolor(black)) ///
			xtitle("Interaction coefficient") ylabel(-.01(.005).01) xlabel("") title("Panel b. Age")  ysize(12) xsize(8)
graph save fig2_age.gph,  replace

*To get the regression outputs for Table C.2
esttab ///
      m5 m6 m7 m8 ///
       using "tablec2.rtf", ///
	   label mlabels(,titles) nogap compress b(4) se(4) nostar nonumbers   replace

*Panel c: age
logit no_mask c.education##i.treatment 
est store Face_Mask
est store m9
logit greeting c.education##i.treatment 
est store Greeting
est store m10
logit host c.education##i.treatment 
est store Host
est store m11
logit social_distance c.education##i.treatment 
est store Distance
est store m12

coefplot Face_Mask Greeting Host Distance, keep(1.treatment#c.education) level(95) vertical yline(0, lcolor(black)) ///
			xtitle("Interaction coefficient") xlabel("") title("Panel c. Education") ysize(12) xsize(8)
graph save fig2_education.gph,  replace   
	   
*To get the regression outputs for Table C.3
esttab ///
      m9 m10 m11 m12 ///
       using "tablec3.rtf", ///
	   label mlabels(,titles) nogap compress b(2) se(2) nostar nonumbers   replace

*Merging the three panels
grc1leg  fig2_gender.gph fig2_age.gph fig2_education.gph, legendfrom(fig2_gender.gph) row(1)

**************************************************************
** 				Supplementary Material						**	
**************************************************************

**************
**Appendix A**
**************
tab country

**************
**Appendix B**
**************

*Figure B.1
ciplot no_mask greeting host social_distance, by(countryid) ///
			ylabel(0(.1)1) note("") ytitle("Mean of non-compliance") xtitle("") xlabel(, valuelabel) ///
			xline(9.5 18.5 27.5 36.5 45.4 54.5 63.5 72.5 81.5 90.5 99.5, lcol(black)) ///
			legend(position(6) row(1))
		
*Figure B.2. 
ciplot occasion_mask necessary_mask if no_mask==1, by(countryid) ///
			ylabel(0(.1).5) note("") ytitle("Mean") xtitle("") xlabel(, alternate valuelabel) ///
			legend(position(6) row(1))	title("Panel a. No mask")
graph save b1.gph, replace		

ciplot occasion_greeting necessary_greeting if greeting==1, by(countryid) ///
			ylabel(0(.1).5) note("") ytitle("") xtitle("") xlabel(, alternate valuelabel) ///
			legend(position(6) row(1))	title("Panel b. Greeting")
graph save b2.gph, replace	

ciplot occasion_host necessary_host if host==1, by(countryid) ///
			ylabel(0(.1).5) note("") ytitle("Mean") xtitle("") xlabel(, alternate valuelabel) ///
			legend(position(6) row(1))	title("Panel c. Host")
graph save b3.gph, replace	

ciplot occasion_distance necessary_distance if social_distance==1, by(countryid) ///
			ylabel(0(.1).5) note("") ytitle("") xtitle("") xlabel(, alternate valuelabel) ///
			legend(position(6) row(1))	title("Panel d. No distance")
graph save b4.gph, replace		

*Combine
grc1leg b1.gph b2.gph b3.gph b4.gph, legendfrom(b1.gph) row(2)


*Table B.1		
est clear 
bysort countryid: eststo: quietly estpost sum age female education  
esttab  using "TableB1.rtf", cells(" mean(fmt(2)) sd(fmt(2))")  label   mlabels(,titles) replace
	
**************
**Appendix C**
************** 

*See previous commands in Part 2 above (esttab command)
	
**************
**Appendix D**
************** 

reg no_mask treatment [pweight=weight]
reg greeting treatment [pweight=weight]
reg host treatment [pweight=weight]
reg social_distance treatment [pweight=weight]

*Figure D.1
cibar no_mask [aweight=weight] , over1(treatment) over2(countryid) level(95) ///
		graphopts( text(.9 30 "ATE = +.089")  xlabel(, valuelabel alternate labsize(vsmall)) ylabel(0(.1)1) legend(pos(6) row(1) order(1 "Control group" 2 "Guilty-free treatment") )  ///
		ytitle("Mean of non-compliance")  title("Panel a:" "Not wearing a face mask", size(small)))
graph save fig_d1.gph, replace	

cibar greeting [aweight=weight], over1(treatment) over2(countryid) level(95) ///
		graphopts(text(.9 30 "AME = +.120")  xlabel(, valuelabel alternate labsize(vsmall)) ylabel(0(.1)1) legend(pos(6) row(1) order(1 "Control group" 2 "Guilty-free treatment"))  ///
		ytitle("")  title("Panel b:" "Greeting", size(small)))
graph save fig_d2.gph, replace	
		
cibar host [aweight=weight], over1(treatment) over2(countryid) level(95) ///
		graphopts(text(.9 30 "ATE = +.165")  xlabel(, valuelabel alternate labsize(vsmall))  ylabel(0(.1)1) legend(pos(6) row(1) order(1 "Control group" 2 "Guilty-free treatment"))  ///
		ytitle("Mean of non-compliance")  title("Panel c:" "Host", size(small))) 
graph save fig_d3.gph, replace	
		
cibar social_distance [aweight=weight], over1(treatment) over2(countryid) level(95) ///
		graphopts(text(.9 30 "ATE = +.141")  xlabel(, valuelabel alternate labsize(vsmall)) ylabel(0(.1)1) legend(pos(6) row(1) order(1 "Control group" 2 "Guilty-free treatment"))  ///
		ytitle("")  title("Panel d:" "No  distance", size(small)))
graph save fig_d4.gph, replace	

grc1leg fig_d1.gph fig_d2.gph fig_d3.gph fig_d4.gph, legendfrom(fig_d1.gph)  row(2) ysize(18)
	
*Figure D.2
*Gender
logit no_mask i.female##i.treatment [pweight=weight]
est store Face_Mask
logit greeting i.female##i.treatment [pweight=weight]
est store Greeting
logit host i.female##i.treatment [pweight=weight]
est store Host
logit social_distance i.female##i.treatment [pweight=weight]
est store Distance

coefplot Face_Mask Greeting Host Distance, keep(1.female#1.treatment) level(95) vertical yline(0, lcolor(black)) ///
			xtitle("Interaction coefficient") xlabel("") title("Panel a. Gender")  ysize(12) xsize(8) legend(position(6) row(1))
graph save fig_d2_gender.gph,  replace

*Age
logit no_mask c.age##i.treatment [pweight=weight]
est store Face_Mask
est store m5
logit greeting c.age##i.treatment  [pweight=weight]
est store Greeting
est store m6
logit host c.age##i.treatment  [pweight=weight]
est store Host
est store m7
logit social_distance c.age##i.treatment  [pweight=weight]
est store Distance
est store m8

coefplot Face_Mask Greeting Host Distance, keep(1.treatment#c.age) level(95) vertical yline(0, lcolor(black)) ///
			xtitle("Interaction coefficient") xlabel("") title("Panel b. Age")  ysize(12) xsize(8)
graph save fig_d2_age.gph,  replace

*Education		
logit no_mask c.education##i.treatment   [pweight=weight]
est store Face_Mask
est store m9
logit greeting c.education##i.treatment [pweight=weight]
est store Greeting
est store m10
logit host c.education##i.treatment [pweight=weight]
est store Host
est store m11
logit social_distance c.education##i.treatment [pweight=weight]
est store Distance
est store m12

coefplot Face_Mask Greeting Host Distance, keep(1.treatment#c.education) level(95) vertical yline(0, lcolor(black)) ///
			xtitle("Interaction coefficient") xlabel("") title("Panel c. Education") ysize(12) xsize(8)
graph save fig_d2_education.gph,  replace

grc1leg  fig_d2_gender.gph fig_d2_age.gph fig_d2_education.gph, legendfrom(fig_d2_gender.gph) row(1)
	
*Figure D.3
logit no_mask treatment i.countryid 
est store d1
margins, at(treatment=(0 1))
marginsplot,  level(95) ylabel(.1(.1).6) title("No mask", size(small)) ///
				ytitle("ATE") plotopts(connect(none)) xlabel(-0.5 " "  0  "Control"  1 "Treatment" 1.5 " ") xtitle("")
graph save fig_d3_a.gph, replace

logit greeting treatment i.countryid 
est store d2
margins, at(treatment=(0 1))
marginsplot,  level(95) ylabel(.1(.1).6) title("Greeting", size(small)) ///
				ytitle("") plotopts(connect(none)) xlabel(-0.5 " "  0  "Control"  1 "Treatment" 1.5 " ") xtitle("")
graph save fig_d3_b.gph, replace

logit host treatment i.countryid 
est store d3
margins, at(treatment=(0 1))
marginsplot,  level(95) ylabel(.1(.1).6) title("Host", size(small)) ///
				ytitle("ATE") plotopts(connect(none)) xlabel(-0.5 " "  0  "Control"  1 "Treatment" 1.5 " ") xtitle("")
graph save fig_d3_c.gph, replace

logit social_distance treatment i.countryid 
est store d4
margins, at(treatment=(0 1))
marginsplot,  level(95)  ylabel(.1(.1).6) title("No distance", size(small)) ///
				ytitle("") plotopts(connect(none)) xlabel(-0.5 " "  0  "Control"  1 "Treatment" 1.5 " ") xtitle("")
graph save fig_d3_d.gph, replace
						
graph combine fig_d3_a.gph fig_d3_b.gph fig_d3_c.gph fig_d3_d.gph, row(2)

*Table D.1
esttab ///
      d1 d2 d3 d4 ///
       using "tabled1.rtf", ///
	   label mlabels(,titles) nogap compress b(2) se(2) nostar nonumbers   replace
				
*Figure D.4
logit social_distance  treatment i.age i.treatment#i.age 
margins, dydx(treatment) at(age=(18(2)80))

*Table D.2-5
*ssc install rwolf (if not installed)

set seed 76751

* create unique variables for DV's in each country
gen no_mask_aus=no_mask if countryid==1
gen no_mask_aut=no_mask if countryid==2
gen no_mask_bra=no_mask if countryid==3
gen no_mask_fra=no_mask if countryid==4
gen no_mask_deu=no_mask if countryid==5
gen no_mask_ita=no_mask if countryid==6
gen no_mask_nzl=no_mask if countryid==7
gen no_mask_pol=no_mask if countryid==8
gen no_mask_esp=no_mask if countryid==9
gen no_mask_swe=no_mask if countryid==10
gen no_mask_gbr=no_mask if countryid==11
gen no_mask_usa=no_mask if countryid==12

gen greeting_aus=greeting if countryid==1
gen greeting_aut=greeting if countryid==2
gen greeting_bra=greeting if countryid==3
gen greeting_fra=greeting if countryid==4
gen greeting_deu=greeting if countryid==5
gen greeting_ita=greeting if countryid==6
gen greeting_nzl=greeting if countryid==7
gen greeting_pol=greeting if countryid==8
gen greeting_esp=greeting if countryid==9
gen greeting_swe=greeting if countryid==10
gen greeting_gbr=greeting if countryid==11
gen greeting_usa=greeting if countryid==12

gen host_aus=host if countryid==1
gen host_aut=host if countryid==2
gen host_bra=host if countryid==3
gen host_fra=host if countryid==4
gen host_deu=host if countryid==5
gen host_ita=host if countryid==6
gen host_nzl=host if countryid==7
gen host_pol=host if countryid==8
gen host_esp=host if countryid==9
gen host_swe=host if countryid==10
gen host_gbr=host if countryid==11
gen host_usa=host if countryid==12

gen socialdistance_aus=social_distance if countryid==1
gen socialdistance_aut=social_distance if countryid==2
gen socialdistance_bra=social_distance if countryid==3
gen socialdistance_fra=social_distance if countryid==4
gen socialdistance_deu=social_distance if countryid==5
gen socialdistance_ita=social_distance if countryid==6
gen socialdistance_nzl=social_distance if countryid==7
gen socialdistance_pol=social_distance if countryid==8
gen socialdistance_esp=social_distance if countryid==9
gen socialdistance_swe=social_distance if countryid==10
gen socialdistance_gbr=social_distance if countryid==11
gen socialdistance_usa=social_distance if countryid==12

* Calc. Romano Wolff p-values for treatment coefs (regression models)

* Note: matrix P prints:
* col.1: unadjusted p-val
* col.2: resampling p-val
* col.3: Romano Wolff p-val
* col.4: Bonferroni adj. p-val

* Masks

local newseed = floor((100000-1+1) * runiform() + 1)
dis `newseed'
rwolf no_mask_aus no_mask_aut no_mask_bra no_mask_fra no_mask_deu no_mask_ita no_mask_nzl no_mask_pol no_mask_esp no_mask_swe no_mask_gbr no_mask_usa, indepvar(treatment) reps(1D3) seed(`newseed') nodots

mat RW = e(RW)
mat B = RW[1..., 1] * 12
mat P = RW , B
mat lis P, format(%5.4f)


* Greeting
local newseed = floor((100000-1+1) * runiform() + 1)
dis `newseed'
rwolf greeting_aus greeting_aut greeting_bra greeting_fra greeting_deu greeting_ita greeting_nzl greeting_pol greeting_esp greeting_swe greeting_gbr greeting_usa, indepvar(treatment) reps(1D3) seed(`newseed') nodots

mat RW = e(RW)
mat B = RW[1..., 1] * 12
mat P = RW , B
mat lis P, format(%5.4f)


* Host
local newseed = floor((100000-1+1) * runiform() + 1)
dis `newseed'
rwolf host_aus host_aut host_bra host_fra host_deu host_ita host_nzl host_pol host_esp host_swe host_gbr host_usa, indepvar(treatment) reps(1D3) seed(`newseed') nodots

mat RW = e(RW)
mat B = RW[1..., 1] * 12
mat P = RW , B
mat lis P, format(%5.4f)


* Social distance
local newseed = floor((100000-1+1) * runiform() + 1)
dis `newseed'
rwolf socialdistance_aus socialdistance_aut socialdistance_bra socialdistance_fra socialdistance_deu socialdistance_ita socialdistance_nzl socialdistance_pol socialdistance_esp socialdistance_swe socialdistance_gbr socialdistance_usa, indepvar(treatment) reps(1D3) seed(`newseed') nodots

mat RW = e(RW)
mat B = RW[1..., 1] * 12
mat P = RW , B
mat lis P, format(%5.4f)
	
	
	
	
	
	
	
	
	
	
	
